using System;
using System.Collections.Generic;


namespace SpringNH.Model
{
	[Serializable]
	public class Items: IEquatable<Items>
	{

		#region Private Members

		private string _itemlink; 
		private string _itemtitle; 
		private byte[] _description; 
		private string _publishdate; 		
		#endregion

		#region Constructor

		public Items()
		{
			_itemlink = String.Empty; 
			_itemtitle = String.Empty; 
			_description = new byte[]{}; 
			_publishdate = String.Empty; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public Items(
			string itemlink, 
			string itemtitle, 
			byte[] description, 
			string publishdate)
			: this()
		{
			_itemlink = itemlink;
			_itemtitle = itemtitle;
			_description = description;
			_publishdate = publishdate;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual string ItemLink
		{
			get
			{ 
				return _itemlink;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for ItemLink", value, "null");
				
				if(  value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for ItemLink", value, value.ToString());
				
				_itemlink = value;
			}
		}
			
		public virtual string ItemTitle
		{
			get
			{ 
				return _itemtitle;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for ItemTitle", value, "null");
				
				if(  value.Length > 45)
					throw new ArgumentOutOfRangeException("Invalid value for ItemTitle", value, value.ToString());
				
				_itemtitle = value;
			}
		}
			
		public virtual byte[] Description
		{
			get
			{ 
				return _description;
			}
			set
			{
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for Description", value, "null");

				_description = value;
			}

		}
			
		public virtual string PublishDate
		{
			get
			{ 
				return _publishdate;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for PublishDate", value, "null");
				
				if(  value.Length > 45)
					throw new ArgumentOutOfRangeException("Invalid value for PublishDate", value, value.ToString());
				
				_publishdate = value;
			}
		}
			
				
		#endregion 

		#region Public Functions

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			Items castObj = (Items)obj; 
			return ( castObj != null ) &&
				( this._itemlink == castObj.ItemLink );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _itemlink.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(Items other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._itemlink == other.ItemLink );
				   
		}

		#endregion
		
	}
}
